#!/usr/bin/env python3
"""
清理服务协调器缓存的脚本
"""

import sys
import os
sys.path.append(os.path.dirname(os.path.abspath(__file__)))

def clear_service_orchestrator_cache():
    """清理服务协调器缓存"""
    print("开始清理服务协调器缓存...")
    
    try:
        # 导入服务协调器
        from src.services.service_orchestrator import get_service_orchestrator
        
        # 获取服务协调器实例
        orchestrator = get_service_orchestrator()
        
        # 清理缓存
        cache_size = len(orchestrator.query_cache)
        orchestrator.query_cache.clear()
        
        print(f"清理完成，共清理了 {cache_size} 个缓存项")
        
    except Exception as e:
        print(f"清理缓存时出错: {e}")
        import traceback
        traceback.print_exc()

if __name__ == "__main__":
    clear_service_orchestrator_cache()